package com.ysd.lis.controller.lab;

import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.request.AddSampleTypeParam;
import com.ysd.lis.request.SampleTypePageParam;
import com.ysd.lis.service.lab.LabSampleTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Cfz
 * @since 2023-12-13
 */
@Api(tags = "标本类型")
@RestController
@RequestMapping("/api/lab/labSampleType")
public class LabSampleTypeController extends BaseController {
    @Autowired
    private LabSampleTypeService labSampleTypeService;

    @ApiOperation("获取标本类型")
    @GetMapping("/findSampleTypeList")
    public Result findLabSampleTypeList(SampleTypePageParam SampleTypePageParam) {
        return labSampleTypeService.findLabSampleTypeList(SampleTypePageParam);
    }

    @ApiOperation("同步标本类型")
    @GetMapping("/syncSampleType")
    public Result syncSampleType() {
        return labSampleTypeService.syncSampleType();
    }

    @ApiOperation("获取标本类型")
    @GetMapping("/getSampleTypeList/{keyValue}")
    public Result getLabSampleTypeList(@PathVariable String keyValue) {
        SampleTypePageParam a = new SampleTypePageParam();
        a.setKeyWords(keyValue);
        return labSampleTypeService.findLabSampleTypeList(a);
    }

    @ApiOperation("添加标本类型")
    @PostMapping("/addSampleType")
    public Result addSampleType(@RequestBody AddSampleTypeParam addSampleTypeParam) {
        return labSampleTypeService.addSampleType(addSampleTypeParam);
    }

    @ApiOperation("编辑标本类型")
    @PostMapping("/editSampleType")
    public Result editSampleType(@RequestBody AddSampleTypeParam addSampleTypeParam) {
        return labSampleTypeService.editSampleType(addSampleTypeParam);
    }

    @ApiOperation("根据id标本类型")
    @PostMapping("/deleteSampleType")
    public Result deleteSampleType(@RequestBody AddSampleTypeParam addSampleTypeParam) {
        return labSampleTypeService.deleteSampleType(addSampleTypeParam);
    }
}
